04. Two-Asset Portfolio Optimization

Derivation of Optimal Weights on a Two-Asset Portfolio

So how do we set up the portfolio optimization problem? In general, we know that we want high returns and low variance of returns, and that the weights on each asset in our portfolio should sum to 1.

Let's again consider a portfolio a portfolio with 2 assets in it, Stock A and Stock B. We want to solve for the weight on each asset, x_A and x_B .

Our objective function for this problem is the expression for the portfolio variance:

(1)\;\sigma_P^2= x_A^2\sigma_A^2 + x_B^2\sigma_B^2 + 2x_Ax_B\sigma_A\sigma_B\rho_{r_Ar_B}.

This is what we will seek to minimize .

We've seen these quantities before, but let's just briefly recall what all these symbols mean:
\sigma_P^2 is the portfolio variance.
\sigma_A^2 is the variance of the return of Stock A.
\sigma_B^2 is the variance of the return of Stock B.
\rho_{r_Ar_B} is the correlation between the returns of stocks A and B.

Our only constraint is:

(2)\;x_A + x_B = 1

It turns out that this is a problem we can solve analytically. If we substitute (2) into (1) , we will get a function of a single variable:

\sigma_P^2= x_A^2\sigma_A^2 + (1-x_A)^2\sigma_B^2 + 2x_A(1-x_A)\sigma_A\sigma_B\rho_{r_Ar_B}

Now, let's take a breather and look at a plot of \sigma_P^2 as a function of x_A , to get a sense of what the function looks like. Let's assume some values for the variables \sigma_A , \sigma_B , and \rho_{r_Ar_B} .

If, \sigma_A = 0.1 , \sigma_B = 0.05 , and \rho_{r_Ar_B} = 0.25 , then the plot looks like this:

Cool, it's a parabola. So now we see that we are looking for the bottom of that parabola again.

So, since this is a problem in only one variable, x_A , let's take the derivative with respect to x_A , and solve for the value of x_A that makes the resulting expression equal 0:

\frac{\mathrm{d} (\sigma_P^2)}{\mathrm{d} x_A} = 0 = 2x_A\sigma_A^2 -2\sigma_B^2(1-x_A)+2\sigma_A\sigma_B\rho_{r_Ar_B}[-x_A + (1-x_A)]
0 = 2x_A\sigma_A^2 +2\sigma_B^2x_A-2\sigma_B^2+2\sigma_A\sigma_B\rho_{r_Ar_B}[1-2x_A]
x_A[2\sigma_A^2 + 2\sigma_B^2 - 4\sigma_A\sigma_B\rho_{r_Ar_B}] -2\sigma_B^2 + 2\sigma_A\sigma_B\rho_{r_Ar_B}=0
x_A[\sigma_A^2 + \sigma_B^2 - 2\sigma_A\sigma_B\rho_{r_Ar_B}] =\sigma_B^2 - \sigma_A\sigma_B\rho_{r_Ar_B}
x_A = \frac{\sigma_B^2 - \sigma_A\sigma_B\rho_{r_Ar_B}}{\sigma_A^2 + \sigma_B^2 - 2\sigma_A\sigma_B\rho_{r_Ar_B}}

From the constraint condition, (2) , we have:

x_B = 1 - x_A

Now we know the portfolio weights. You can see that they are only dependent on the standard deviations of Stock A and B, and their covariance. If we wanted to know the expected portfolio mean, we only have to remember that it is the weighted sum of the individual portfolio means:

\mu_P = \mu_Ax_A + \mu_Bx_B

To be sure our solution is a minimum , we should check the second-order condition. We will leave this as an exercise to you.